import axios from 'axios'

axios.defaults.baseURL = "http://localhost:8080/";
/**
 * 前端每次请求后端是回先经过此栏截器
 */
axios.interceptors.request.use(function (config) {
  return config;
});

/**
 * 服务器每次响应回前端都会走此拦截器
 */
axios.interceptors.response.use(function (response) {
  let {data,status} = response.data;
  if (status == 210) {
    console.log(data);
    return data;
  } else {
    console.log(response);
  }
});

export default axios;
